package org.example.bean.entity;

import lombok.Data;
import org.apache.struts2.json.annotations.JSON;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @program: example-spring-boot-extend
 * @description:
 * @author: Chenjiabin
 * @create: 2019/4/11 10:09
 **/
@Data
public class User {
    private String id;
    private String name;
    private String username;
    private String password;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date birthDay = new Date();
    private Date cdt = new Date();
    private List<Order> orders = new ArrayList<Order>(0);

    @JSON(format = "yyyy-MM-dd")
    public Date getBirthDay() {
        return birthDay;
    }

    public void setBirthDay(Date birthDay) {
        this.birthDay = birthDay;
    }

    public User() {
    }

    public User(String id, String name, String username, String password) {
        this.id = id;
        this.name = name;
        this.username = username;
        this.password = password;
    }

    public void addOrder(Order order) {
        orders.add(order);
    }
}
